import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY = "1111111"
    # # 工程配置
    # DEBUG = True
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1/information"
    SQLALCHEMY_TRACK_MODIFICATIONS =True

    REDIS_HOST="127.0.0.1"
    REDIS_PORT = 6379
    # 指定session储存方式
    SESSION_TYPE = "redis"
    #指定session的存储对象
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    # 设置session签名  加密
    SESSION_USE_SIGNER  = True
    # 设置session永久保存
    SESSION_PERMAMENT = False
    # 设置session保存的时间
    PERMAENT_SESSION_LIFETIME = 86400 *2


# 开发环境
class DevelopConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


# 生产环境
class ProductConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR

class TestingConfig(Config):
    DEBUG = True


config = {
    "develop":DevelopConfig,
    "product":ProductConfig,
    "texting":TestingConfig
}